#{extends 'include/base.html' /}
#{set title:'注册' /}
<div class="register_wrap">
    <div class="register_wrap_left">
        <h3>加入D.FRWi，你可以:</h3>
        <br/>
        <p>D.FRWi——集结品牌创意分享平台。</p>
        <p>分享全球最顶尖的创意品牌，让分享激发更</p>
        <p>多创意。任何人都可以加入D.FRWi，欢迎在</p>
        <p>此展现你的创意，开拓你的新天地。</p>
        <br/>
        <p class="register_wrap_left_item register_wrap_left_item_first">展示你的作品</p>
        <p class="register_wrap_left_item">增加眼光及挣取佣金</p>
        <p class="register_wrap_left_item">与其他创意人结交互动</p>
        <p class="register_wrap_left_item">推荐你的作品到微信公众平台等媒体</p>
    </div>
    <div class="register_wrap_right">
        <h3>请认真填写下列现象信息</h3>

        <form action="@{Api.addUser()}">
        <div class="register_input_win">
            <div class="register_input_wrap"><span>*</span><label>用户名:</label> <input type="text" name="account.account" id="account"/></div>
            <div class="register_input_wrap"><span>*</span><label>密码:</label><input type="password" name="account.password" id="password"/></div>
            <div class="register_input_wrap"><span>*</span><label for="repass">确认密码: </label><input type="password" id="repassword" name="repassword"/></div>
            <div class="register_input_wrap"><span>*</span><label for="email">Email地址: </label><input type="text" name="account.email" id="email"/></div>
            <div class="register_input_wrap"><span>*</span><label>您当前的地址:</label><input type="text" name="account.address" id="address"/></div>
            <div class="register_input_wrap"><span>*</span><label>您从事的领域:</label><select name="account.workArea" id="workArea">
            #{list items:list,as :'item'}
                <option value="${item.typeName}">${item.typeName}</option>
            #{/list}
            </select></div>
            <div class="register_input_wrap"><span>*</span><label>请输入验证码</label><input type="text" class="register_validate" name="validate" id ="validate"/>
                <img src="@{Users.captcha(randomID)}" alt="" style="position:absolute; left: 260px; top: 0px; width: 100px;height: 30px;"/>
                <input type="hidden" value="${randomID}" id="randomID"/>
            </div>
            <p class="register_err hidden">错误</p>
            <div class="my_info_btn_wrap">
                <button class="my_info_btn_wrap_save" type="button" id="btn">提交</button>
                <button class="my_info_btn_wrap_abort">取消</button>
            </div>
        </div>
        </form>
    </div>

</div>
<script type="text/javascript">


    $('#btn').click(function () {
        var account = $('#account').val();
        var password = $('#password').val();
        var repassword = $('#repassword').val();
        var email = $('#email').val();
        var address = $('#address').val();
        var workArea = $('#workArea').val();
        var randomID = $('#randomID').val();
        var validate = $('#validate').val();
        var  data ={
            account:{
            },
            validate:validate,
            randomID:randomID
        };
        data.account.account=account;
        data.account.password=password;
        data.account.address=address;
        data.account.workArea=workArea;
        data.account.email=email;
        data.repassword = repassword;
        $.post('@{Api.addUser()}', data, function(res) {
            console.log(res)
            if(res.result==1) {
                location.href="@{Application.index()}"
            }
            else {
                $('.register_err').text(res.data);
                $('.register_err').removeClass('hidden');
            }
        });
    });

</script>
